cmake_minimum_required(VERSION 3.4.1)

project(hello CXX)
# 设置模块根目录（CMakeLists.txt 位于 app/src/main/jni/）
set(MODULE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../)

# 添加 Oboe 头文件路径（根据实际路径调整）
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

# 定义 Oboe 库路径（自动适配不同 ABI）
set(OBOE_LIB_DIR ${CMAKE_SOURCE_DIR}/jniLibs/${ANDROID_ABI})

# 导入预编译的 Oboe 库（分 ABI 处理）
add_library(oboe SHARED IMPORTED)
set_target_properties(oboe PROPERTIES
        IMPORTED_LOCATION ${OBOE_LIB_DIR}/liboboe.so  # 关键路径修正
        INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/include
        )

# 添加你的源码
add_library(native-lib SHARED OboeEngine.cpp)

# 链接库（注意顺序：系统库放在最后）
target_link_libraries(native-lib
        oboe
        log  # Android 日志库
        )

# 调试配置（可选）
#set(CMAKE_BUILD_TYPE Debug)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")  # 生成调试符号

# Build our own native library
#add_library (native-lib SHARED stringFromSo.c)
#add_library (native-lib SHARED OboeEngine.cpp)
# Find the Oboe package
#find_package (oboe REQUIRED CONFIG)

# Specify the libraries which our native library is dependent on, including Oboe
#target_link_libraries(native-lib log oboe::oboe)

#target_link_libraries(native-lib log)